namespace CodeConsult.Nordic.nRF8001.ApplicationControlInterface.Commands.SystemCommands
{
    public class OpenAdvPipeCommand : AciCommandBase
    {
        public const byte OpCode = 0x1B;

        public byte[] AdvServiceDataPipes { get; set; }

        protected override void EncodeBuffer()
        {
            Error = Error || AdvServiceDataPipes == null || AdvServiceDataPipes.Length != 8;

            if (Error) return;

            EncodeBufferWithCommandHeader(OpCode, 8);
            EncodeHelper.SetBytes(AdvServiceDataPipes);
        }
    }
}
